package com.br4mmie.asciistory.map;

import com.br4mmie.asciistory.CharImage;
/**
 * Object to be placed on the map.
 * @author Niels Schoemaker
 */

public class MapObject {
	
	//Instance variables
	protected CharImage image;
	protected int locX, locY;
	
	public MapObject()
	{
		
	}
	
	//setters
	public void setX(int x)
	{
		locX = x;
	}
	public void setY(int y)
	{
		locY = y;
	}
	
	
	//getters
	public int getX()
	{
		return locX;
	}
	public int getY()
	{
		return locY;
	}
	
	public void setImage(CharImage image)
	{
		this.image = image;
	}
	
	/**
	 * moves this object relatively
	 * @param dX the amount to move to the right
	 * @param dY the amount to move downwards
	 */
	public void move(int dX, int dY)
	{
		locX += dX;
		locY += dY;
	}
	
	/**
	 * draws this MapObject to target
	 * @param target the target CharImage to draw to
	 */
	public void draw(CharImage target)
	{
		image.draw(target, locX, locY);
	}
	public void draw(CharImage target, int offsetX, int offsetY)
	{
		image.draw(target, locX-offsetX, locY-offsetY);
	}

	public void onLoop()
	{
	}
}
